package notes.java.java8.demo.newtime;

import java.time.Instant;
import java.util.concurrent.TimeUnit;

/** 时间戳*/
public class D1_Instant {
	
	public static void main(String[] args) {
		
		// 当前时间（Instant 默认使用UTC时区）
		Instant instant = Instant.now();
		System.out.println("now:" + instant);
		
		//　秒数
		System.out.println("秒数:" + instant.getEpochSecond());
		
		// 毫秒数
		System.out.println("毫秒数" +instant.toEpochMilli());
		
		// 增加8小时
		Instant nowTime = instant.plusMillis(TimeUnit.HOURS.toMillis(8));
		System.out.println("now time+8:" + nowTime);
		
	}

}
